home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / asuper1a / form1.frm < prev    next >
Text File  |  1999-10-20  |  5KB  |  157 lines

  1. VERSION 5.00
  2. Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
  3. Begin VB.Form MenuForm 
  4.    BorderStyle     =   4  'Festes Werkzeugfenster
  5.    Caption         =   "Player"
  6.    ClientHeight    =   2100
  7.    ClientLeft      =   45
  8.    ClientTop       =   285
  9.    ClientWidth     =   3675
  10.    Icon            =   "Form1.frx":0000
  11.    LinkTopic       =   "Form2"
  12.    MaxButton       =   0   'False
  13.    MinButton       =   0   'False
  14.    Moveable        =   0   'False
  15.    ScaleHeight     =   2100
  16.    ScaleWidth      =   3675
  17.    ShowInTaskbar   =   0   'False
  18.    Begin VB.TextBox Text5 
  19.       Height          =   285
  20.       Left            =   6120
  21.       TabIndex        =   4
  22.       Text            =   "Text5"
  23.       Top             =   1200
  24.       Width           =   1335
  25.    End
  26.    Begin VB.TextBox Text4 
  27.       Height          =   285
  28.       Left            =   6120
  29.       TabIndex        =   3
  30.       Text            =   "Text4"
  31.       Top             =   960
  32.       Width           =   1335
  33.    End
  34.    Begin VB.TextBox Text3 
  35.       Height          =   285
  36.       Left            =   6120
  37.       TabIndex        =   2
  38.       Text            =   "Text3"
  39.       Top             =   720
  40.       Width           =   1335
  41.    End
  42.    Begin VB.TextBox Text2 
  43.       Height          =   285
  44.       Left            =   6120
  45.       TabIndex        =   1
  46.       Text            =   "Text2"
  47.       Top             =   480
  48.       Width           =   1335
  49.    End
  50.    Begin VB.TextBox Text1 
  51.       Height          =   285
  52.       Left            =   6120
  53.       TabIndex        =   0
  54.       Text            =   "Text1"
  55.       Top             =   240
  56.       Width           =   1335
  57.    End
  58.    Begin MSComDlg.CommonDialog CommonDialog1 
  59.       Left            =   120
  60.       Top             =   0
  61.       _ExtentX        =   847
  62.       _ExtentY        =   847
  63.       _Version        =   393216
  64.       CancelError     =   -1  'True
  65.    End
  66.    Begin VB.Menu mOptions 
  67.       Caption         =   "&Options"
  68.       Begin VB.Menu mChangeBackgroundPicture 
  69.          Caption         =   "Change Background &Picture"
  70.       End
  71.       Begin VB.Menu mInstructions 
  72.          Caption         =   "&Instructions"
  73.       End
  74.       Begin VB.Menu mSeparator 
  75.          Caption         =   "-"
  76.       End
  77.       Begin VB.Menu mExit 
  78.          Caption         =   "&Exit"
  79.       End
  80.    End
  81. End
  82. Attribute VB_Name = "MenuForm"
  83. Attribute VB_GlobalNameSpace = False
  84. Attribute VB_Creatable = False
  85. Attribute VB_PredeclaredId = True
  86. Attribute VB_Exposed = False
  87.  
  88. Option Explicit
  89.  
  90.  
  91. Private hRgn As Long
  92.  
  93. Private Const OFN_FILEMUSTEXIST = &H1000
  94. Private Const OFN_HIDEREADONLY = &H4
  95. Private Const OFN_LONGNAMES = &H200000
  96. Private Const OFN_NONETWORKBUTTON = &H20000
  97. Private Const OFN_PATHMUSTEXIST = &H800
  98. Private Const CC_FULLOPEN = &H2
  99. Private Const CC_SOLIDCOLOR = &H80
  100. Private Const CC_RGBINIT = &H1
  101. Private Const CC_ANYCOLOR = &H100
  102.  
  103. Private Sub Form_Load()
  104.     CommonDialog1.Color = vbWhite
  105.     SetRegion
  106.     ShapedForm.Show
  107. End Sub
  108.  
  109. Private Sub Form_Unload(Cancel As Integer)
  110.     If hRgn Then DeleteObject hRgn
  111.     Unload ShapedForm
  112. End Sub
  113.  
  114. Private Sub mChangeBackgroundPicture_Click()
  115.     On Error Resume Next
  116.     Err.Clear
  117.     With CommonDialog1
  118.         .DialogTitle = "Please Select a Picture"
  119.         .Flags = OFN_FILEMUSTEXIST + OFN_HIDEREADONLY + OFN_LONGNAMES + OFN_NONETWORKBUTTON + OFN_PATHMUSTEXIST
  120.         .Filter = "All Picture Files|*.bmp;*.dib;*.gif;*.jpg;*.wmf;*.emf;*.ico;*.cur|Bitmaps (*.bmp;*.dib)|*.bmp;*.dib|GIF Images (*.gif)|*.gif|JPEG Images (*.jpg)|*.jpg|Metafiles (*.wmf;*.emf)|*.wmf;*.emf|Icons (*.ico;*.cur)|*.ico;*.cur|All Files (*.*)|*.*"
  121.         .ShowOpen
  122.         If Err.Number = 32755 Then Exit Sub
  123.         .Flags = CC_FULLOPEN + CC_SOLIDCOLOR + CC_RGBINIT + CC_ANYCOLOR
  124.         .ShowColor
  125.         If Err.Number = 32755 Then Exit Sub
  126.         On Error GoTo erro
  127.         ShapedForm.Visible = False
  128.         DoEvents
  129.         ShapedForm.Picture = LoadPicture(.FileName)
  130.         ShapedForm.Width = ShapedForm.Picture.Width
  131.         ShapedForm.Height = ShapedForm.Picture.Height
  132.         SetRegion
  133.     End With
  134. erro:
  135.     If Err.Number <> 0 Then MsgBox "Error Number " & Err.Number & " : " & Err.Description, vbApplicationModal + vbCritical
  136.     ShapedForm.Visible = True
  137. End Sub
  138.  
  139. Private Sub mExit_Click()
  140.     Unload Me
  141. End Sub
  142.  
  143. Private Sub SetRegion()
  144.     If hRgn Then DeleteObject hRgn
  145.     hRgn = GetBitmapRegion(ShapedForm.Picture, CommonDialog1.Color)
  146.     SetWindowRgn ShapedForm.hwnd, hRgn, True
  147. End Sub
  148.  
  149. Private Sub mInstructions_Click()
  150.     Dim Texto As String
  151.     Texto = "This is what really happens:" & vbCrLf & vbCrLf
  152.     Texto = Texto & "The Background Picture of the Form and a particular colour is passed to a function. Then, the Image is scanned and all pixels that have equal colour to the Transparent Colour are removed from the Image, creating a new virtual Image (a Region, to be exact) that will be used by the form. The smaller the picture is, the faster it is scanned." & vbCrLf & vbCrLf & vbCrLf
  153.     Texto = Texto & "Programmed by Pedro Lamas" & vbCrLf & "Copyright ⌐1997-1999 Underground Software" & vbCrLf & vbCrLf
  154.     Texto = Texto & "Home-Page (Dedicated to VB): www.terravista.pt/portosanto/3723/" & vbCrLf & "E-Mail: sniper@hotpop.com"
  155.     MsgBox Texto, vbApplicationModal + vbInformation, "Instructions"
  156. End Sub
  157.